package org.etlt.expression;

import org.etlt.expression.datameta.Variable;

import java.util.HashMap;
import java.util.Map;

public class MainContext implements VariableContext {

    private static MainContext INSTANCE = new MainContext();

    private Map<String, Object> data = new HashMap<>();

    private MainContext(){
    }

    protected static MainContext getInstance(){
        return INSTANCE;
    }

    @Override
    public Variable getVariable(String name) {
        Object value = this.data.get(name);
        return Variable.createVariable(name, value);
    }

    protected Map<String, Object> getData(){
        return this.data;
    }
}
